<!-- 组件模版 -->
<template>
  <div>
    <div v-if="taskList.length > 0">
      <!-- 任务列表 -->
      <el-card class="mt20 df aic" v-for="(item,index) in taskList" :key="index">
        <div class="df" @click="selectChange(item,index)">
          <el-checkbox class="mt5" :value="(selectFlag === index)"></el-checkbox>
          <div class="task-item ml10">
            <div class="df aic jcsb" style="min-width:310px">
              <div class="fwb">{{item.taskTitle}}</div>
              <el-tag effect="dark" v-if="item.busStatus == '1'">进行中</el-tag>
              <el-tag effect="dark" type="danger" v-else-if="item.busStatus == '2'">已延期</el-tag>
              <el-tag effect="dark" type="success" v-else>已完成</el-tag>
            </div>
            <div class="fs14 c6 mt5 mb5">{{item.staskItemList.length}}项子任务</div>
            <div>
              <i class="el-icon-date mr5 mt5 mb5"></i>
              {{item.createTime.substr(0,10)}} 创建
            </div>
            <div>
              <i class="el-icon-date mr5 mt5 mb5"></i>
              {{item.endDate}} 截止
            </div>
            <div class="price fs15 mt5 mb5">来源：{{item.createByName}}</div>
            <div class="fs15 mt5 mb5">
              协作：
              <span
                class="mr10"
                v-for="(coopItem, coopIndex) in item.staskItemList"
                :key="coopIndex"
              >{{coopItem.nickName}}</span>
            </div>
            <div
              class="fs15 cs-text"
              v-if="item.staskNoticeList && item.staskNoticeList.length > 0"
            >
              抄送：
              <span
                class="mr10"
                v-for="(noticeItem,noticeIndex) in item.staskNoticeList"
                :key="noticeIndex"
              >{{noticeItem.nickName}}</span>
            </div>
          </div>
        </div>
      </el-card>
    </div>
    <el-empty class="mt50" v-else description="暂无数据"></el-empty>
  </div>
</template>

<script>
export default {
  props: {
    taskList: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      selectFlag: undefined
    };
  },
  methods: {
    selectChange(item, index) {
      // console.log(index);
      this.selectFlag = index;
      this.$emit("changeDetails", item);
    }
  }
};
</script>

<style lang="less" scoped>
.task-item {
  font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB,
    Microsoft YaHei, SimSun, sans-serif;
  .cs-text {
    color: #e6a23c;
  }
}
</style>
